import logging
import os

def setup_logging(log_level=logging.INFO):
    """设置日志配置"""
    logging.basicConfig(
        level=log_level,
        format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
        datefmt='%Y-%m-%d %H:%M:%S'
    )
    logger = logging.getLogger(__name__)
    return logger

def log_args(args):
    """记录训练参数"""
    logger = logging.getLogger(__name__)
    logger.info("Training parameters:")
    for k, v in vars(args).items():
        logger.info(f"  {k}: {v}")